package com.gupaoedu.vip.pattern.singleton.lazy;

/**
* @Author:         Temple
* @Date:           2019/4/16 23:20
* @Version:        1.0
* @Description:    java类作用描述
*/

//懒汉式单例
//在外部需要使用的时候才进行实例化
public class LazySimpleSingleton {
    private LazySimpleSingleton(){}
    //静态块，公共内存区域
    private static LazySimpleSingleton lazy = null;
    public synchronized static LazySimpleSingleton getInstance(){
        if(lazy == null){
            lazy = new LazySimpleSingleton();
        }
        return lazy;
    }
}
